DEPTH           = ../..
topsrcdir       = @top_srcdir@
srcdir          = @srcdir@
VPATH           = @srcdir@

include $(DEPTH)/config/autoconf.mk

APP_NAME = $(MOZ_APP_DISPLAYNAME)

ifdef MOZ_DEBUG
APP_NAME := $(APP_NAME)Debug
endif

_AVAILABLE_LOCALES =\
    en-US \
    $(NULL)

_EXTRA_LOCALES =\
    cs \
    de \
    es-ES \
    fi \
    fr \
    gl \
    he \
    it \
    ja \
    ko \
    nl \
    pl \
    ru \
    sl \
    sv-SE \
    zh-CN \
    zh-TW \
    hu \
    sr \
    $(NULL)

_EXTENSIONS_=\
	fs \
	gfd \
	markdown \
	op1 \
	tipoftheday \
	$(NULL)

libs::$(_AVAILABLE_LOCALES) $(_EXTRA_LOCALES)
	mkdir -p $(FINAL_TARGET)/distribution/extensions
	rm -f $(FINAL_TARGET)/distribution/extensions/*.xpi
	rm -f $(srcdir)/*.xpi
	$(foreach f,$^, cd $(srcdir)/`basename $f`; zip -qr ../langpack-`basename $f`@bluegriffon.org.xpi `find . -type f | grep -v svn` ;)
	$(foreach f,$^, cd $(topsrcdir)/bluegriffon/locales/`basename $f`; zip -qr $(topsrcdir)/bluegriffon/langpacks/langpack-`basename $f`@bluegriffon.org.xpi `find bluegriffon/base -type f | grep -v svn` ;)
	$(foreach f,$^, cd $(topsrcdir)/bluegriffon/locales/`basename $f`; zip -qr $(topsrcdir)/bluegriffon/langpacks/langpack-`basename $f`@bluegriffon.org.xpi `find bluegriffon/sidebars -type f | grep -v svn` ;)
	$(foreach f,$^, cd $(topsrcdir)/bluegriffon/locales/`basename $f`; zip -qr $(topsrcdir)/bluegriffon/langpacks/langpack-`basename $f`@bluegriffon.org.xpi `find bluegriffon/extensions -type f | grep -v svn` ;)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
	$(INSTALL) $(srcdir)/*.xpi $(DIST)/$(APP_NAME).app/Contents/MacOS/extensions
else
	$(INSTALL) $(srcdir)/*.xpi $(DIST)/bin/distribution/extensions
#	rm $(srcdir)/*.xpi
endif

include $(topsrcdir)/config/rules.mk

